package cn.iotab.iotkit.transport.mqtt.conf;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MqttServerConfig {

    private String host;
    private Integer port;

    private NettyConf nettyConf = new NettyConf();

    private MqttConf mqttConf = new MqttConf();

    private SslConf sslConf = new SslConf();

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class NettyConf {
        private String leakDetectorLevel;
        private Integer bossGroupThreadCount;
        private Integer workerGroupThreadCount;
        private boolean keepAlive;
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class MqttConf{
        private int maxPayloadSize;
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class SslConf {
        private boolean sslEnable = false;
        private String sslProtocol;
        private String keyStoreFile;
        private String keyStorePassword;
        private String keyPassword;
        private String keyStoreType;
        //
        private boolean skipValidityCheckForClientCert;
    }

}
